package com.linkgie.galaxyframework.shell;

import org.jline.utils.AttributedString;
import org.jline.utils.AttributedStyle;

public class CommandException extends ShellException{
	
	private static final long serialVersionUID = -6560011470519808542L;

	private AttributedString styleMessage;
	
	public CommandException(AttributedString message) {
		this.styleMessage = message;
	}
	
	public CommandException(String message) {
		super(message);
		setStyleMessage(message);
	}
	
	public CommandException(String message, AttributedStyle style) {
		super(message);
		styleMessage = new AttributedString(message, style);
	}
	
	public CommandException(String message , AttributedStyle style, Throwable cause) {
		super(message, cause);
		styleMessage = new AttributedString(message, style);
	}
	
	public CommandException(String message, Throwable cause) {
		super(message, cause);
		setStyleMessage(message);
	}
	
	private void setStyleMessage(String message) {
		styleMessage = new AttributedString(message, AttributedStyle.DEFAULT.foreground(AttributedStyle.RED));
	}

	public AttributedString getStyleMessage() {
		return styleMessage;
	}
}
